import React from 'react';
import MediaPad from '@compa/MediaPad';
import IconButton from '@compa/IconButton';
import './index.css';

const Carousel = ({ list, type }) => {

    function generateItemTemplate(list, type, otherClass) {
        if (!list || list.length === 0) return (<></>);
        switch (type) {
            case 1:
                return list.map((item, i) => (
                    <MediaPad key={`item-${i}`} className="item" pad={item}></MediaPad>
                ));
            case 2:
                return list.map((item, i) => (
                    <IconButton key={i} index={i} text={item.name} path="aa" otherClass={'findind-banner-btn'} />
                ));
            default:
                return (<></>)
        }
    }
    return (
        <div className="carousel-container">
            <div className="slider">
                {
                    generateItemTemplate(list, type)
                }
            </div>
        </div>
    )
}



export default Carousel;